package com.tanhua;

import com.tanhua.db.User;

public class UserHolder {
    private static  ThreadLocal<User> tl=new ThreadLocal<User>();

    //将资源放入线程容器中
    public static void saveUser(User user){

        tl.set(user);
    }

    //将资源放入线程容器中删除
    public static void removeUser(){

        tl.remove();
    }

    //将资源从线程容器中获取
    public static User getUser() {
        return tl.get();
    }
}
